package com.zth.configuration;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.zth.interceptor.LoginInterceptor;

@Configuration
public class LoginConfig implements WebMvcConfigurer{
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		
		InterceptorRegistration registration=registry.addInterceptor(new LoginInterceptor());
		
		registration.addPathPatterns("/pages/**");//拦截所有页面
		
		registration.excludePathPatterns(//不拦截的页面
				"/ssb/user/loginByNameAndPassword"
				,"/blog/blogAll"
				,"/user/loginByNameAndPassword"
				,"/pages/user/login.html"
				,"/pages/user/login1.html"
				,"/pages/front/**"
				,"/js/**"
				,"/css/**"
				,"/images/**"
				,"/editor/**"
				,"/frontTool/**"
				);
	}
}
